package com.lframework.xingyun.api.open;

import com.lframework.starter.web.core.annotations.openapi.OpenApi;
import com.lframework.starter.web.core.components.resp.InvokeResult;
import com.lframework.starter.web.core.components.resp.InvokeResultBuilder;
import com.lframework.starter.web.core.controller.DefaultBaseController;
import com.lframework.xingyun.sc.service.retail.RetailOutSheetService;
import com.lframework.xingyun.sc.vo.retail.out.CreateRetailOutSheetVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * 零售出库单(open-api)
 *
 * @author mos
 */
@Api(tags = "零售出库单(open-api)")
@Validated
@RestController
@RequestMapping("/open/retail/out/sheet")
public class RetailOutSheetOpenApiController extends DefaultBaseController {

    @Autowired
    private RetailOutSheetService retailOutSheetService;

    /**
     * 直接创建零售出库单并审核通过
     */
    @OpenApi(sign = true)
    @ApiOperation("直接审核通过")
    @PostMapping("/direct")
    public InvokeResult<Void> directApprovePass(@RequestBody @Valid CreateRetailOutSheetVo vo) {

        retailOutSheetService.directApprovePass(vo);

        return InvokeResultBuilder.success();
    }

}
